home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-03-06 | 2.0 KB | 70 lines | [TEXT/GEOL] |
- Item 1674726 25-Sept-89 21:22
-
- From: KNEPPER Knepper, Christopher
-
- To: MACAPP.TECH$ MACAPP Tech
- MACAPP.TEST MacApp SQA Team
-
- Sub: TCluster enhancement
-
- TCluster should have a SetCurrent method to complement ReportCurrent.
-
- PROCEDURE TCluster.SetCurrent(id:IDType; redraw:boolean);
-
- Example: It might be used in an application's preferences dialog, in which
- the identifier of the radio button selected in a preferences dialog is
- stored with the application (eg. in a resource):
-
- {-----------------------------------------------------------------------------}
- {$S ARes}
-
- FUNCTION TMyApplication.Preferences(id:IDType):IDType;
- VAR
- aWindow: TWindow;
- aDialog: TDialogView;
- aCluster: TCluster;
- dismisser: IDType;
- BEGIN
- aWindow := NewTemplateWindow(kMyDialog, NIL);
- FailNIL(aWindow);
- aDialog := TDialogView(aWindow.FindSubView('Dlog'));
- FailNIL(aDialog);
- aCluster := TCluster(aDialog.FindSubView('Clst'));
- FailNIL(aCluster);
- aCluster.SetCurrent(id, kDontRedraw); { !!! SetCurrent !!! }
- dismisser := aDialog.PoseModally;
- IF dismisser = 'A-OK' THEN
- Preferences := aCluster.ReportCurrent
- ELSE
- Preferences := id; { return original setting }
- END;
-
- {-----------------------------------------------------------------------------}
-
- This is my initial effort at coding such a method:
-
- {-----------------------------------------------------------------------------}
- {$S DlgRes}
-
- PROCEDURE TCluster.SetCurrent(id:IDType; redraw:boolean);
-
- PROCEDURE SetRadioByID(theSubView: TView);
- BEGIN
- IF Member(theSubView,TRadio) THEN
- BEGIN
- IF (theSubView.fIdentifier = id) THEN
- TRadio(theSubView).SetState(TRUE,redraw)
- ELSE
- TRadio(theSubView).SetState(FALSE,redraw);
- END;
- END;
-
- BEGIN
- EachSubView(SetRadioByID);
- END;
-
- {-----------------------------------------------------------------------------}
-
- -Chris
-
-